/*
 *
 */

module.exports = function(client) {
    console.log('initialization sql-category-object');

    this.get = function(callback) {

        client.query('SELECT \
        id as cid, name as cName, icon, des, orders \
        FROM ms_category \
        ORDER BY orders DESC, id DESC', function(err, res) {
            if (err) {
                console.log(err);
                return callback(ResCode.getCode(1000));
            }

            return callback(ResCode.getCode(0, res));
        });
    };

    return this;
};